var host = 'http://localhost:8080/';
// var host = 'http://192.168.209.104:8080/';
// var host = 'http://op.juhe.cn/';

function  getData(url,method,data={},header={}){
  return new Promise(function(resolve,reject){
    wx.request({
      url: host+url,
      data: data,
      method: method,
      header:header,
      success:function(res){
        console.log('api',res)
        if(res.statusCode==200){
          resolve(res.data)
        }else{
          reject('error');
        }
      },
      fail:function(e){
        reject(e)
      }
    })
  })
}

module.exports ={
  getData:getData
}